import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type {
  UserFollowVO,
  UserFollowForm,
  UserFollowQuery,
} from "@/api/userFollow/types";

/**
 * 查询用户关注列表
 * @param query
 * @returns {*}
 */

export const listUserFollow = (
  query?: UserFollowQuery
): AxiosPromise<UserFollowVO[]> => {
  return request({
    url: "/business/userFollow/list",
    method: "get",
    params: query,
  });
};

/**
 * 查询用户关注详细
 * @param id
 */
export const getUserFollow = (
  id: string | number
): AxiosPromise<UserFollowVO> => {
  return request({
    url: "/business/userFollow/" + id,
    method: "get",
  });
};

/**
 * 新增用户关注
 * @param data
 */
export const addUserFollow = (data: UserFollowForm) => {
  return request({
    url: "/business/userFollow",
    method: "post",
    data: data,
  });
};

/**
 * 修改用户关注
 * @param data
 */
export const updateUserFollow = (data: UserFollowForm) => {
  return request({
    url: "/business/userFollow",
    method: "put",
    data: data,
  });
};

/**
 * 删除用户关注
 * @param id
 */
export const delUserFollow = (id: string | number | Array<string | number>) => {
  return request({
    url: "/business/userFollow/" + id,
    method: "delete",
  });
};

/**
 * 查询登录用户是否关注当前用户
 * @param id
 */
export const statusFollow = (id: string | number) => {
  return request({
    url: "/business/userFollow/status/" + id,
    method: "get",
  });
};
